jihyeon's Blog

2023-11-26

문서 검색


https://www.acmicpc.net/problem/1543

문자열 탐색 문제

doc = input() word = input() result = 0 index = 0 while index + len(word) <= len(doc): if doc[index:index + len(word)] == word: index += len(word) result += 1 else: index += 1 print(result)

Copyright (c) 2023. jihyeon Choi. | All Right Reserved.